BATT-MAN Click
BATT-MAN Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.
Click Library
- Author : MikroE Team
- Date : sep 2020.
- Type : GPIO type
Software Support
Example Description
BATT-MAN Click is a very versatile battery operated power manager. When powered via mikroBUS, it will charge the connected Li-Ion/Li-Po 3.7V battery, while providing the output voltage on all its outputs at the same time.
Example Libraries
- MikroSDK.Board
- MikroSDK.Log
- Click.BattMan
Example Key Functions
- battman_cfg_setup Config Object Initialization function.
void battman_cfg_setup(battman_cfg_t *cfg)
Config Object Initialization function.
Click configuration structure definition.
Definition battman.h:106
- battman_init Initialization function.
BATTMAN_RETVAL battman_init(battman_t *ctx, battman_cfg_t *cfg)
Initialization function.
Click ctx object definition.
Definition battman.h:90
- battman_set_enable Controls the operation of the Click.
void battman_set_enable(battman_t *ctx, uint8_t state)
Enable/Disable control.
- battman_get_charging_indicator Charging indicator status.
uint8_t battman_get_charging_indicator(battman_t *ctx)
Charging indicator status.
Application Init
Initializes the Click driver and logger utility and enables the Click board.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
log_printf( &logger, "BATT-MAN Click enabled.\r\n" );
chg_flag = 0;
}
#define BATTMAN_MAP_MIKROBUS(cfg, mikrobus)
Definition battman.h:63
void application_init(void)
Definition main.c:40
#define MIKROBUS_POSITION_BATTMAN
Definition main.c:29
Application Task
Checks the charging indicator status, and in relation to its state it displays an appropriate message on USB UART.
{
{
if ( chg_flag == 1 )
{
log_printf( &logger, "Charging enabled.\r\n" );
}
chg_flag = 0;
}
else
{
if ( chg_flag == 0 )
{
log_printf( &logger, "Charging disabled.\r\n" );
}
chg_flag = 1;
}
}
void application_task(void)
Definition main.c:69
Application Output
This Click board can be interfaced and monitored in two ways:
- Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
- UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Additional Notes and Information
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.